//
//  CoinEachVC.m
//  AppNew
//
//  Created by 华伟 on 2019/4/8.
//  Copyright © 2019 华伟. All rights reserved.
//

#import "CoinEachVC.h"
#import "CoinEachCell.h"
@interface CoinEachVC ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong)UITableView *eachtable;
@end

@implementation CoinEachVC
- (void)_initView{
    UITableView *tbl = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) style:UITableViewStyleGrouped];
    tbl.delegate = self;
    tbl.dataSource = self;
    [tbl registerNib:[UINib nibWithNibName:@"CoinEachCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"CoinEachCellCell"];
    [self.view addSubview:tbl];
    _eachtable = tbl;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self _initView];
}

#pragma mark -- tableview

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    CoinEachCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CoinEachCellCell" forIndexPath:indexPath];
    if(!cell){
        cell = [[CoinEachCell alloc] init];
    }
    
    if(indexPath.section == 0){
        if(indexPath.row == 0){
            cell.left.text = @"";
            cell.label1.text = @"价格";
            cell.label2.text = @"数量";
            cell.label3.text = @"累计";
        }else{
            cell.left.text = @"卖6";
            cell.label1.text = @"价格";
            cell.label3.text = @"累计";
            cell.label2.text = [NSString stringWithFormat:@"第%ld个",indexPath.row];
        }
    }else if (indexPath.section == 1){
        if(indexPath.row == 0){
            cell.left.text = @"";
            cell.label1.text = @"时间";
            cell.label2.text = @"方价";
            cell.label3.text = @"数量";
        }else{
            cell.left.text = @"买入";
            cell.label1.text = @"价格";
            cell.label3.text = @"累计";
            cell.label2.text = [NSString stringWithFormat:@"第%ld个",indexPath.row];
        }
    }
    return cell;
}
@end
